std::stack::top
From Cppreference
| C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||
| Containers library | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| std::stack | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| reference top();
| ||
| const_reference top() const;
| ||
Returns reference to the top element in the stack. This is the most recently pushed element. This element will be removed on a call to pop(). Effectively calls c.back().
Contents |
Parameters
(none)
Return value
reference to the last element
Complexity
constant
See also
| inserts element at the top (public member function) | |
| removes the first element (public member function) | |